import 'dart:typed_data';

import 'package:json_annotation/json_annotation.dart';
import 'package:my_flutter_test/models/utils.dart';

part 'briefItems.g.dart';
/// 物品缩略信息，用于显示物品列表
@JsonSerializable(explicitToJson: true)
class BriefItems{
  List<BriefItem> items;

  BriefItems(this.items);

  factory BriefItems.fromJson(Map<String, dynamic> json) => _$BriefItemsFromJson(json);

  Map<String, dynamic> toJson() => _$BriefItemsToJson(this);
}
@JsonSerializable(explicitToJson: true)
class BriefItem{
  @JsonKey(toJson:bytes2base64,fromJson: base2bytes)
  Uint8List img;
  String name;
  String price;
  int id;

  BriefItem(this.img, this.name, this.price, this.id);

  factory BriefItem.fromJson(Map<String, dynamic> json) => _$BriefItemFromJson(json);

  Map<String, dynamic> toJson() => _$BriefItemToJson(this);
}